//
//  Rootview.m
//  ZLShang
//
//  Created by wangguangming on 15/7/24.
//  Copyright © 2015年 Amber. All rights reserved.
//

#import "Rootview.h"
#import "Base.h"
@implementation Rootview
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
        {
        
        [self addall];
        }
    return self;
}
-(void)addall
{
    

    self.scroll=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT-44)];
    
        // self.scroll.backgroundColor=[UIColor cyanColor];
    [self addSubview:self.scroll];
    
  
   
    
    self.waitDistributions=[[UIView alloc] initWithFrame:CGRectMake(5, 10, WIDTH-10, (WIDTH-10)/3)];
  
    self.waitDistributions.layer.cornerRadius=6;
    self.waitDistributions.layer.borderColor=[[UIColor whiteColor] CGColor];
    self.waitDistributions.layer.borderWidth=3;
    
    self.waitDistributions.backgroundColor=[UIColor redColor];
    [self.scroll addSubview:self.waitDistributions];
    
    self.distributions=[[UIButton alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.waitDistributions.frame)+10, WIDTH/2-10, (WIDTH/2-10)*2/3)];
       self.distributions.backgroundColor=[UIColor brownColor];
    [self.scroll addSubview:self.distributions];
    
    self.distributions.layer.cornerRadius=6;
    self.distributions.layer.borderColor=[[UIColor whiteColor] CGColor];
    self.distributions.layer.borderWidth=3;

    self.sends=[[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.distributions.frame)+10, CGRectGetMinY(self.distributions.frame), WIDTH/2-10, (WIDTH/2-10)*2/3)];
   
    self.sends.backgroundColor=[UIColor brownColor];
    [self.scroll addSubview:self.sends];
    
    self.sends.layer.cornerRadius=6;
    self.sends.layer.borderColor=[[UIColor whiteColor] CGColor];
    self.sends.layer.borderWidth=3;
    
    
    self.waitSends=[[UIButton alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.distributions.frame)+10,  WIDTH-10, (WIDTH-10)/3)] ;
  
    self.waitSends.backgroundColor=[UIColor redColor];
    [self.scroll addSubview:self.waitSends];
    
    self.waitSends.layer.cornerRadius=6;
    self.waitSends.layer.borderColor=[[UIColor whiteColor] CGColor];
    self.waitSends.layer.borderWidth=3;
    
    
    self.cancels=[[UIButton alloc] initWithFrame:CGRectMake(5, CGRectGetMaxY(self.waitSends.frame)+10,  WIDTH/2-10, (WIDTH/2-10)*2/3)];
    self.cancels.backgroundColor=[UIColor orangeColor];
      [self.scroll addSubview:self.cancels];
    
    self.cancels.layer.cornerRadius=6;
    self.cancels.layer.borderColor=[[UIColor whiteColor] CGColor];
    self.cancels.layer.borderWidth=3;
    
    
    self.problem=[[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.cancels.frame)+10, CGRectGetMinY(self.cancels.frame), WIDTH/2-10,  (WIDTH/2-10)*2/3)];
    self.problem.backgroundColor=[UIColor orangeColor];
  
    [self.scroll addSubview:self.problem];
    
    self.problem.layer.cornerRadius=6;
    self.problem.layer.borderColor=[[UIColor whiteColor] CGColor];
    self.problem.layer.borderWidth=3;
    
    self.scroll.contentSize=CGSizeMake(0, CGRectGetMaxY(self.problem.frame)+64);
    
    self.menuTable=[[UITableView alloc] initWithFrame:CGRectMake(0, 64, 0, HEIGHT-64)];
    [self addSubview:self.menuTable];
    
}
-(void)setItemforview:(UIView *)view{

    UIImageView *imageview=[[UIImageView alloc] init];
    imageview.frame=CGRectMake(10, 0, view.frame.size.width-20, view.frame.size.width-20);
    
    UILabel *namelabel=[[UILabel alloc] initWithFrame:CGRectMake(10, view.frame.size.width-20, view.frame.size.width-20, 20)];
    
    [view addSubview:imageview];
    [view addSubview:namelabel];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
